package cn.game.entry;

public class Card {
	private String color;// 花色
	private int number;// 牌面数字
	
	public Card(){
		
	}
	
	public Card(String color,int number){
		this.color = color;
		this.number = number;
	}
	
	/**
	 *两张牌花色和数字都相同
	 * @param card
	 * @return
	 */
	public boolean equals(Card card) {
		if(card == null)
			return false;
		return this.color.equals(card.getColor()) && (this.number == card.getNumber()) ;
	}
	
	/**
	 * 两张牌数字相同
	 * @param card
	 * @return
	 */
	public boolean equalsIgnoreColor(Card card) {
		if(card == null)
			return false;
		return this.number == card.getNumber();
	}
	
	/**
	 * 两张牌花色相同
	 * @param card
	 * @return
	 */
	public boolean suit(Card card){
		if(card == null)
			return false;
		return this.color.equals(card.getColor()) ;

	}
	
	/**
	 * 不区分花色比大小
	 * 
	 */
	public int compare(Card card){
		int result = 0;
		if(card == null){
			result = 1;
		}
		if(this.number > card.getNumber()){
			result = 1;
		}else if(this.number < card.getNumber()){
			result = -1;
		}
		
		return result;
	}
	@Override
	public String toString() {
		
		return this.color+this.number;
	}
	
	public String getColor() {
		return color;
	}
	public void setColor(String color) {
		this.color = color;
	}
	public int getNumber() {
		return number;
	}
	public void setNumber(int number) {
		this.number = number;
	}

	
}
